﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class WsTesting : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void _addButton_Click(object sender, EventArgs e)
    {
        // get the parameter from the text box
        String parameter = _parameterTextbox.Text;
        _parameterList.Items.Add( parameter);
    }
    protected void _clearButton_Click(object sender, EventArgs e)
    {
        _parameterList.Items.Clear();
    }
    protected void _goButton_Click(object sender, EventArgs e)
    {
        try
        {
            WsTestingService.WsTestingServiceClient wsTesting =
                new WsTestingService.WsTestingServiceClient();

            String auth_url = _wsdlUrl.Text;
            String operation_name = _operationName.Text;


            List<string> arguments = new List<string>();
            foreach (ListItem item in _parameterList.Items)
            {
                arguments.Add(item.ToString());
            }

            String results = wsTesting.WsTesting(auth_url, operation_name, arguments.ToArray());

            _results.Text = results;
        }
        catch (Exception ex)
        {
            String message =
                "An Exception occured in WsTesting tester. " + ex.Message;
            _results.Text = message;
        }
    }


}